package com.hugh.dubbo.service.consumer.service.impl;

import com.hugh.dubbo.api.HelloService;
import com.hugh.dubbo.service.consumer.service.TestOneService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: Hugh
 * @Date: 2020/6/14
 */
@Service
@Slf4j
public class TestOneServiceImpl implements TestOneService {


    @Reference
    private HelloService helloService;

    /**
     * 通过扩展Dubbo的Filter（TransportIPFilter），完成Web请求的真实IP透传到Dubbo服务当中，并在Dubbo服务中打印请求的IP
     * @param name
     * @return
     */
    @Override
    public Object getTestOne(String name) {
        String s = helloService.sayHello2You(name);
        log.info("TestOneService res :{}", s);
        return s;
    }
}
